#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
void* mythread(void* arg)
{
    (void)arg;
    while(1)
    {
         printf("i am mythread\n");
        // pthread_exit(NULL);
        pthread_cancel(pthread_self());
        sleep(1);
    }
    return NULL;
}

int main()
{
    pthread_t tn;
    int ret = pthread_create(&tn,NULL,mythread,NULL);
    if(ret != 0)
    {
        perror("pthread_create()\n");
        return 0;
    }
    pthread_join(tn,NULL);
   // printf("main\n");
    while(1)
    {
        printf("this is main\n");
        sleep(1);
    }
    return 0;
}
